/**
 *
 */
package ua.ws.feedsreader.loaders;

import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
import ua.ws.feedsreader.managers.FeedsManager;

/**
 * @author ricardo
 *
 */
public class SchedulerManager implements Runnable {

    private static final Logger LOGGER = Logger.getLogger(SchedulerManager.class.getName());

    /* (non-Javadoc)
     * @see java.lang.Runnable#run()
     */
    public void run() {

        LOGGER.log(Level.INFO, "Begining the load of Feeds.");

        FeedsManager fm = new FeedsManager();
        String path = null;

        try {
            path = new File("./..").getCanonicalPath() + "/webapps/feedsreader/WEB-INF/classes/configurations/sites.txt";
            try {
                fm.loadAllFeeds(path);
                //fm.closeConnection();
            } catch (Exception ex) {
                Logger.getLogger(SchedulerManager.class.getName()).log(Level.SEVERE, null, ex);
            }

        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        LOGGER.log(Level.INFO, "All feeds where added.");
    }
}
